package edu.njfu.sas.servlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @Classname ServletDemo3
 * @Description TODO
 * @Date 2020/11/10 11:36 上午
 * @Created by lqj(1724226325@qq.com)
 */
@WebServlet("/demo3")
public class ServletDemo3 extends HttpServlet {
    /**
     * Get 请求与 Post请求的区别:
     *  1. Get拉的方式,请求的数据量小,请求的数据体现在url上
     *  2. Post请求 推方式,请求的数据量可以非常大,请求的数据不会体现在url上
     */
    /**
     *
     * @param req
     * @param resp
     * @throws ServletException
     * @throws IOException
     */
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
             resp.getWriter().write("hello get!");
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
              resp.getWriter().write("hello post!");
    }
}
